Nested p2m: flush only one p2m table when reallocating.
authorTim Deegan <Tim.Deegan@citrix.com>
Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)
committerTim Deegan <Tim.Deegan@citrix.com>
Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)
It's unhelpful to flush all of them when we only need one.

Reported-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
xen/arch/x86/mm/p2m.c

index a74dd37e77ab3c76008405c8c49392e484ac66b4..e9cd4fc51d06067e5e8c1bfc8b91e17afc86cff2 100644 (file)
@@ -1120,7 +1120,6 @@ p2m_get_nestedp2m(struct vcpu *v, uint64_t cr3)
     volatile struct nestedvcpu *nv = &vcpu_nestedhvm(v);
     struct domain *d;
     struct p2m_domain *p2m;
-    int i;
 
     /* Mask out low bits; this avoids collisions with CR3_EADDR */
     cr3 &= ~(0xfffull);
@@ -1146,12 +1145,9 @@ p2m_get_nestedp2m(struct vcpu *v, uint64_t cr3)
     }
 
     /* All p2m's are or were in use. Take the least recent used one,
-     * flush it and reuse.
-     */
-    for (i = 0; i < MAX_NESTEDP2M; i++) {
-        p2m = p2m_getlru_nestedp2m(d, NULL);
-        p2m_flush_locked(p2m);
-    }
+     * flush it and reuse. */
+    p2m = p2m_getlru_nestedp2m(d, NULL);
+    p2m_flush_locked(p2m);
     nv->nv_p2m = p2m;
     p2m->cr3 = cr3;
     nv->nv_flushp2m = 0;